package com.designmodel.designmodel.OBERRVER_Pattern_观察者模式;

import com.designmodel.designmodel.OBERRVER_Pattern_观察者模式.service.IhanFeizi;

public class Watch extends  Thread {
	private IhanFeizi ihanFeizi;
	private String switchOp="1";

	public String getSwitchOp() {
		return switchOp;
	}

	public void setSwitchOp(String switchOp) {
		System.out.println("11");
		this.switchOp = switchOp;
	}

	public IhanFeizi getIhanFeizi() {
		return ihanFeizi;
	}

	public void setIhanFeizi(IhanFeizi ihanFeizi) {
		this.ihanFeizi = ihanFeizi;
	}


	@Override
	public void run() {
		while (true){
			if("1".equals(switchOp)){
				ihanFeizi.eat();
				this.switchOp="0";
			}

		}
	}
}
